<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core">


    <ui:composition template="/WEB-INF/faces/template.xhtml">
        <ui:define name="title">addRoom</ui:define>


        <ui:define name="content">

            <!-- Check admin login -->
            <ui:include src="/resources/include/checkAdminLogin.xhtml" /> 

<!--            <c:if test="${sessionScope['loginUser'].auth == 1}">-->
            <h:panelGroup layout="block">

                <h:form>
                    <h1>Create new RoomType</h1>
                    <table>
                        <tr>
                            <td>RoomType:</td>
                            <td>
                                <h:selectOneMenu id="RoomTypes" value="#{addRoomTypeBackingBean.name}">
                                    <f:selectItem id="Single" itemLabel="Single" itemValue="Single"/>
                                    <f:selectItem id="Double" itemLabel="Double" itemValue="Double"/>
                                    <f:selectItem id="Suite" itemLabel="Suite" itemValue="Suite"/>
                                </h:selectOneMenu>
                            </td>
                        </tr>
                        <tr>
                            <td>NrOfBeds</td>
                            <td>
                                <h:inputText label="NrOfBeds:"
                                             value="#{addRoomTypeBackingBean.nrOfBeds}"
                                             required="true"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <h:commandButton value="AddRoomType" action="#{addRoomTypeControllerBean.addRoomType}"/>
                            </td>
                        </tr>

                    </table>
                </h:form>



                <h:form>


                    <br/>
                    <h1>Add new room</h1>
                    <table>
                        <tr>

                            <td>Room Number:</td>
                            <td>

                                <h:inputText label="Room Number:"
                                             value="#{addRoomBackingBean.roomNb}"
                                             required="true"/>           
                            </td>
                        </tr>
                        <tr>
                            <td>Bathroom:</td>
                            <td>
                                <h:selectBooleanCheckbox value="#{addRoomBackingBean.bathRoom}"/>
                            </td>
                        </tr>
                        <tr>
                            <td>Kitchen:</td>
                            <td>
                                <h:selectBooleanCheckbox value="#{addRoomBackingBean.kitchen}"/>
                            </td>
                        </tr>
                        <tr>
                            <td>RoomType:</td>
                            <td>
                                <h:selectOneMenu value="#{addRoomBackingBean.roomType}">
                                    <c:forEach items="${addRoomTypeControllerBean.roomType}" var="roomType">
                                        <f:selectItem itemLabel="#{roomType.name}" itemValue="#{roomType.name}"/>
                                    </c:forEach>
                                </h:selectOneMenu>
                            </td>
                        </tr>
                        <tr>
                            <td>Price per Night</td>
                            <td>
                                <h:inputText label="Price:"
                                             value="#{addRoomBackingBean.price}"
                                             required="true"/>
                            </td>
                        </tr>
                    </table>
                    <h:commandButton value="Add" action="#{addRoomControllerBean.addRoom}"/> 
                </h:form>
            </h:panelGroup>
            <!--            </c:if>-->

        </ui:define>
    </ui:composition>

</html>

